package com.whli.jee.system.controller;

import com.whli.jee.common.web.controller.BaseController;
import com.whli.jee.common.web.service.IBaseService;
import com.whli.jee.system.entity.SysSequenceDetail;
import com.whli.jee.system.service.ISysSequenceDetailService;
import com.whli.jee.system.vo.SysSequenceDetailVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 * <em>类或方法作用描述</em>
 * @author whli
 * @version 2018/9/4 9:26
 * */
@RestController
@RequestMapping(value="/system/sysSequenceDetail")
@Api(description = "序列规则明细API")
public class SysSequenceDetailController extends BaseController<SysSequenceDetail, SysSequenceDetailVO> {

	@Autowired
	private ISysSequenceDetailService sysSequenceDetailService;
	
	@Override
    public IBaseService<SysSequenceDetail> getService() {
        return sysSequenceDetailService;
    }


    /**
     * 查询同级别下是否存在同一序号
     * @param entity
     * @return
     */
    @PostMapping(value = "/getByParentIdAndSort")
    @ApiOperation("查询同级别下是否存在相同序号")
    public boolean getByParentIdAndSort(SysSequenceDetail entity){
        SysSequenceDetail detail = sysSequenceDetailService.getByParentIdAndSort(entity);
        if (detail != null){
            return false;
        }
        return true;
    }
}

